package com.csmht.tododemo.controller.admin;

import com.csmht.tododemo.annotation.RoleIntercept;
import com.csmht.tododemo.pojo.enumeration.RoleEnum;
import com.csmht.tododemo.result.Result;
import com.csmht.tododemo.service.UserService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin")
@Slf4j
@RoleIntercept(roles = {RoleEnum.ADMIN})
public class AdminController {

    @Resource
    private UserService userService;


    @PutMapping("/add")
    public Result<Object> add(@RequestParam Long userId){
        userService.addAdmin(userId);
        return Result.success();
    }

}
